<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <button @click="flag = !flag">切换</button>
      <!-- <h3 v-show="flag">showtime</h3> -->
      <h6 v-if="flag">v-if</h6>
      <h1 v-else>v-if</h3>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script>
      //v-show和v-if的应用场景
      //频繁切换用v-show  首次屏幕开销大 用v-if
      const vm = new Vue({
        el: "#app",
        data: {
          flag: true,
        },
        methods: {},
      });
    </script>
  </body>
</html>
